<tal:block tal:define="url php:(preg_match('/\?/', current_uri)) ? (current_uri . '&') : (current_uri . '?')">
	<p class="pagination_control" tal:condition="php:pageCount GT 0" tal:define="url php:preg_replace('/(page=\d+|&page=\d+)/', '', url)">
		<span tal:condition="exists:previous"><a tal:attributes="href string:${url}page=${previous}">Previous</a>&nbsp;&nbsp;&nbsp;</span>
		<span tal:condition="php:firstPageInRange > 1"><a class="pagination-link" tal:define="prev_page php:firstPageInRange - 1" tal:attributes="href string:${url}page=${prev_page}">...</a>&nbsp;&nbsp;&nbsp;</span>
		<span tal:repeat="page pagesInRange"><a tal:attributes="class php:(current == page) ? 'current pagination-link' : 'pagination-link';href string:${url}page=${page}" tal:content="page">#</a>&nbsp;&nbsp;&nbsp;</span> 
		<span tal:condition="php:lastPageInRange< pageCount"><a class="pagination-link"	tal:define="next_page php:lastPageInRange + 1" tal:attributes="href string:${url}page=${next_page}">...</a>&nbsp;&nbsp;&nbsp;</span>
		<span tal:condition="exists:next"><a href="javascript:void(0)" tal:attributes="href string:${url}page=${next}">Next</a></span>
	</p>
</tal:block>